function [post act] = gmmpostBayesVerbeek(mix, data)


K = mix.ncentres;
N = size(data.Y, 1);

[act logact] = gmmactivBayesVerbeek(mix, data);
if isfield(mix.varprior, 'a0')
    log_priors = dirichletln_exp(mix.varposterior.a);
else
    log_priors = log(mix.priors);
end

logpost = repmat(log_priors, N, 1) + logact;
max_logpost = max(logpost, [], 2);
logpost = logpost - repmat(max_logpost, 1, size(logpost, 2));

post = exp(logpost);
post = post./(sum(post, 2)*ones(1, K));
